package com.ciaojian.worker.model.param;

import cn.hutool.core.bean.BeanUtil;
import com.ciaojian.core.model.HairArchive;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @author oxiny
 */
@Data
@Builder
@Accessors(chain = true)
public class HairArchiveParam {
    @ApiModelProperty("用户ID")
    @NotNull(message = "用户ID不能为空")
    private Integer userId;

    @ApiModelProperty("发型师ID")
    @NotNull(message = "发型师ID不能为空")
    private Integer workerId;

    @ApiModelProperty("发型师名称")
    @NotBlank(message = "发型师名称不能为空")
    private String workerName;

    @ApiModelProperty("档案图片")
    @Size(min = 1,message = "请上传至少一张照片")
    @NotNull(message = "请上传至少一张照片")
    private List<HairArchiveImgDTO> images;

    /**
     * 转换为实体
     *
     * @return /
     */
    public HairArchive convert() {
        HairArchive hairArchive = HairArchive.builder().build();
        BeanUtil.copyProperties(this, hairArchive);
        return hairArchive;
    }
}
